package com.violet.auth.client.util;

import org.springframework.security.oauth2.provider.token.DefaultAuthenticationKeyGenerator;

import java.util.Map;
import java.util.UUID;

public class CustomAuthenticationKeyGenerator extends DefaultAuthenticationKeyGenerator {

    private static final String RAND = "keyGeneratorRand";

    @Override
    protected String generateKey(Map<String, String> values) {
        // 加入一个随机的要素,保证每次调用时生成的们的hash都不一样
        values.put(RAND, UUID.randomUUID().toString());
        return super.generateKey(values);
    }
}
